import java.io.File;

public class FileComprhensive {
    //在指定的文件夹下建立子文件夹
    public static boolean creatFile(){
        String diskName = "E:\\a\\b\\c";
        File diskFile = new File(diskName);
       boolean a =  diskFile.delete();
        System.out.println(a);
       return diskFile.mkdirs();
    }
    //获得文件夹的名字用：对象名.getPath();
    public static void getDirectoryName(String strPath){
        File objPath = new File(strPath);
        File[] files = objPath.listFiles();
        if(files.length == 0 || files == null){
            return;
        }
        for (File file1: files
             ) {

            if(file1.isDirectory() && file1 != null){
                System.out.println("文件夹："+file1.getPath());
            }
        }

    }
    //获取文件的的名字
    public static void getFileName(String path){
        File file = new File(path);
        File[] files = file.listFiles();
        if(files == null || files.length == 0){
            return;
        }
        for (File file1:files){
            if(file1 != null && file1.isFile()){
                System.out.println(file1.getName());
            }
        }
    }

    public static void main(String[] args) {
        System.out.println(creatFile());
        getDirectoryName("E:\\myFile");
        getFileName("E:\\eidtplus");
    }

}
